package test;

import jpb.Application;
import jpb.module.daomain.member.Member;
import jpb.module.service.department.DepartmentService;
import jpb.module.service.load.LoadService;
import jpb.module.service.organize.OrganizeService;
import jpb.util.GsonUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.File;
import java.io.FileInputStream;
import java.util.List;

/**
 * Created by haol on 2017/4/13.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
public class test {

        @Autowired
        private LoadService loadService;

        @Autowired
        private DepartmentService departmentService;

        @Autowired
        private OrganizeService organizeService;

        @Test
        public void sd() {
                try {
                        String oid = "83d5261b-9cdb-444f-afa8-fa324235052d";
                        String oid1 = "7af3e09a-7c7e-411e-8331-5b8f5861a90e";
                        String[] head = new String[]{"编号", "职称"};
                        loadService.download("D:\\TelPhone", "workbook.xls");
                } catch (Exception e) {
                        e.printStackTrace();
                }
                return;

        }

        @Test
        public void s() {
                String oid = "c18d6dbc-3158-418e-829c-729c6c32ce9d";

                List<Member> members = organizeService.getFollowMem(oid);
              System.out.println(GsonUtil.toJson(members));
                return;

        }

        @Test
        public void ssss() {
                String[] s = new String[]{"s", "s"};
                System.out.println(s.length);
        }

        @Test
        public void up() {
                File dir = new File("D:\\TelPhone\\");
                File file = new File(dir, "模板c18d6dbc-3158-418e-829c-729c6c32ce9d.xls");
                try {
                        FileInputStream inputStream = new FileInputStream(file);
                        HSSFWorkbook workbook = new HSSFWorkbook(inputStream);
                       // loadService.handleExcel(workbook);
                } catch (Exception e) {
                        e.printStackTrace();
                }

        }


}
